package com.yikome.config;

import java.util.Optional;

import org.springframework.data.domain.AuditorAware;
import org.springframework.stereotype.Component;

import com.yikome.utils.SecurityUtils;

@Component
public class AuditorAwareConfig implements AuditorAware<String> {

    @Override
    public Optional<String> getCurrentAuditor() {
    	
    	try {
    		return Optional.of(SecurityUtils.getCurrentUsername());
    	}catch (Exception e) {
			return Optional.of("anonymous");
		}
    }

}